import request from "@/utils/request";

let baseUrl = process.env.VUE_APP_XS_API;

export function enjoyRemind(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/enjoyRemind`,
    method: "get",
    params
  });
}
export function checkMercAccStatus(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/checkMercAccountStatus`,
    method: "get",
    params
  });
}
export function flowAlert(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/flowAlert`,
    method: "get",
    params
  });
}
export function checkUpFlowBalance(params) {
  return request({
    url: `${baseUrl}/business_admin/aliPay/checkUpFlowBalance`,
    method: "get",
    params
  });
}
// 享惠生活看板
export function enjoyBoardShow(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/enjoyBoardShow`,
    method: "get",
    params
  });
}
// 套餐列表
export function getMercOpenPkg(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/getMercOpenPkg`,
    method: "get",
    params
  });
}
// 套餐金额
export function getOpenAmount(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/getOpenAmount`,
    method: "get",
    params
  });
}
// 计算499 套餐余额
export function calculateManyShop(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/calculateManyShop`,
    method: "get",
    params
  });
}
// 钱包余额查询
export function queryEnjoyAccountBalance(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/queryEnjoyAccountBalance`,
    method: "get",
    params
  });
}
// 开通享惠生活
export function openEnjoyFavour(data) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/openEnjoyFavour`,
    method: "post",
    data
  });
}
// 充值二维码
export function createPayAmountQrCode(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/createPayAmountQrCode`,
    method: "get",
    params
  });
}
// 获取核销报表参数
export function getExportTable(params) {
  return request({
    url: `${baseUrl}/business_admin/sweptWriteOff/writeOffTotalStatistics`,
    method: 'post',
    data:params
  })
}
// 获取当前套餐和流量余额
export function getPackageAndBalance(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/getPackageAndBalance`,
    method: "get",
    params
  });
}
// 商户流量余额记录
export function merchantFlowRecordList(data) {
  return request({
    url: `${baseUrl}/business_admin/flow/merchantFlowRecordList`,
    method: "post",
    data
  });
}
// 商户流量余额记录
export function myPackageFlowList(data) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/merchAppRptDayFlowList`,
    method: "post",
    data
  });
}
// 校验商户是否可升级套餐
export function checkMercUpgradeFlowPkg(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/checkMercUpgradeFlowPkg`,
    method: "get",
    params
  });
}
// 商户升级流量套餐
export function upgradeFlowPkg(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/upgradeFlowPkg`,
    method: "get",
    params
  });
}
// 商户充值享扫账户金额
export function rechargeAmount(data) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/rechargeAmount`,
    method: "post",
    data
  });
}
// 商户APP消耗记录详情
export function merchAppRptDayDetail(data) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/merchAppRptDayDetail`,
    method: "post",
    data
  });
}
// 换取token
export function engoyFavourLogin(params) {
  return request({
    url: `${baseUrl}/uaa/enjoy/flow/engoyFavourLogin`,
    method: "get",
    params
  });
}
// 支付宝支付
export function wapAliPay(data) {
  return request({
    url: `${baseUrl}/business_admin/aliPay/wapAliPay`,
    method: "post",
    data
  });
}
// 支付状态查询
export function queryWapAliStatus(params) {
  return request({
    url: `${baseUrl}/wap/aliPay/queryWapAliStatus`,
    method: "get",
    params
  });
}
// 开户失败修改状态
export function upOpenMerchStatusFail(params) {
  return request({
    url: `${baseUrl}/wap/aliPay/upOpenMerchStatusFail`,
    method: "get",
    params
  });
}
// // 支付状态查询
// export function queryWapAliStatus(params) {
//   return request({
//     url: `${baseUrl}/business_admin/aliPay/queryWapAliStatus`,
//     method: 'get',
//     params
//   })
// }
/********** 会员储值记录 开始 **************/
// 查询会员储值记录
export function queryVipSaveInfoPage(data) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryVipSaveInfoPage`,
    method: "post",
    data
  });
}
// 查询会员储值折线图
export function queryVipSaveLineChart(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryVipSaveLineChart`,
    method: "get",
    params
  });
}
// 获取当前商户会员储值总金额和笔数
export function querySaveTotalAmountNum(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/querySaveTotalAmountNum`,
    method: "get",
    params
  });
}
// 获取当前商户累计会员储值
export function queryVipTotalAmount(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryVipTotalAmount`,
    method: "get",
    params
  });
}
/********** 会员储值记录 结束 **************/
/********** 会员开卡记录 开始 **************/
// 查询会员开卡记录
export function queryVipOpenCardPage(data) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryVipOpenCardPage`,
    method: "post",
    data
  });
}
// 获取当前商户会员开卡类型和人数
export function queryVipCardTypeNum(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryVipCardTypeNum`,
    method: "get",
    params
  });
}
// 查询会员开卡折线图
export function queryVipCardLineChart(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryVipCardLineChart`,
    method: "get",
    params
  });
}
// 获取当前商户会员开卡总金额和笔数
export function queryVipTotalAmountNum(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryVipTotalAmountNum`,
    method: "get",
    params
  });
}
// 获取当前商户累计会员开卡
export function queryVipTotalOpenAmount(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryVipTotalOpenAmount`,
    method: "get",
    params
  });
}
/********** 会员开卡记录 结束 **************/
/********** 会员推广 开始 **************/
// 查询当前商户推广记录
export function queryMerchPromotePage(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryMerchPromotePage`,
    method: "post",
    params
  });
}
// 查询当前商户推广记录累计数据
export function queryMerchPromoteTotalData(params) {
  return request({
    url: `${baseUrl}/business_admin/flow/query/queryMerchPromoteTotalData`,
    method: "post",
    params
  });
}
/********** 会员推广 结束 **************/

/************** 超级会员 ************/
// 获取超级会员相关红点接口
export function queryInvitedStatus(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getRedDot`,
    method: 'get',
    params
  })
}
// 获取超级会员活动红点
export function getActivityRedDot(params) {
  return request({
    url: `${baseUrl}/couponApp/move/getActivityRedDot`,
    method: 'get',
    params
  });
}
// 获取参与者合作记录接口
export function queryRecord(data) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/queryJoinBusinessCooperateRecord`,
    method: 'post',
    data
  });
}
// 待处理(邀请记录)接口
export function queryWaitRecord(data) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getJoinBusinessInviteRecord`,
    method: 'post',
    data
  });
}
// 参与者操作修改折扣、佣金接口(同意修改、拒绝修改)
export function appHandleModify(data) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/appHandleModify`,
    method: 'post',
    data
  });
}
// 取消合作接口
export function cancelCooperation(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/cancelCooperation`,
    method: 'get',
    params
  });
}
// 参与者邀请记录操作(同意加入、拒绝加入)
export function joinBusinessHandleRecord(data) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/joinBusinessHandleRecord`,
    method: 'post',
    data
  });
}
// 解绑桌码
// export function unBindDesk(params) {
//   return request({
//     url: `${baseUrl}/business_admin/qrcode/base/unbindApp`,
//     method: 'delete',
//     params:params
//   })
// }
//商户套餐到期时间详情
export function mercPkgEndInfo(params) {
  return request({
    url: `${baseUrl}/business_admin/enjoyFavour/mercPkgEndInfo`,
    method: "get",
    params
  });
}
//获取邀请者记录
export function getInviterRecord(data) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getInviterRecord?merchantId=${data.merchantId}`,
    method: "post",
    data
  });
}
//邀请者合作记录
export function getInviterCooperationRecords(data) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getInviterCooperationRecords`,
    method: "post",
    data
  });
}
//邀请者合作记录取消合作
export function inviterCancelCooperation(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/inviterCancelCooperation`,
    method: "get",
    params
  });
}
//邀请者相关红点
export function getInviterRedDot(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getInviterRedDot`,
    method: "get",
    params
  });
}
//查询超级会员邀请者的插件状态
export function querySuperMemberStatus(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/querySuperMemberStatus`,
    method: "get",
    params
  });
}
//获取商家资料
export function getBusinessDetail(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getBusinessDetail`,
    method: "get",
    params
  });
}
// 查帐户余额
export function getChannelAccountBalanc(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getChannelAccountBalance`,
    method: "get",
    params
  });
}

export function searchBusinessByPhon(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/searchBusinessByPhone`,
    method: "get",
    params
  });
}
//提交邀请者
export function inviteBusiness(data) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/inviteBusiness?merchantId=${data.merchantId}`,
    method: "post",
    data
  });
}
// 保存邀请者
export function modifyRecord(data) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/modifyRecord?merchantId=${data.merchantId}`,
    method: "post",
    data
  });
}

// 活动列表
export function activityAvailableQuery(data) {
  return request({
    url: `${baseUrl}/couponApp/move/activityAvailableQuery`,
    method: "post",
    data
  });
}
// 活动详情
export function activityDetail(params) {
  return request({
    url: `${baseUrl}/couponApp/move/detail`,
    method: "get",
    params
  });
}
// 同意参与活动
export function activityParticipateIn(params) {
  return request({
    url: `${baseUrl}/couponApp/move/participateIn`,
    method: "get",
    params
  });
}
// 拒绝此活动
export function activityRefuse(params) {
  return request({
    url: `${baseUrl}/couponApp/move/refuse`,
    method: "get",
    params
  });
}
// 活动相关红点
// export function getActivityRedDot(params) {
//   return request({
//     url: `${baseUrl}/couponApp/move/getActivityRedDot`,
//     method: "get",
//     params
//   });
// }

// 返佣订单列表
export function rebateOrder(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/participantQueryMemberOrder`,
    method: 'post',
    data:params
  })
}

// 补贴订单列表
export function subsidyOrder(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/queryOrderSubsidyList`,
    method: 'post',
    data:params
  })
}
// 抽佣订单详情
export function rebateOrderDetail(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getMemberOrderDetail`,
    method: 'get',
    params
  })
}
// 补贴订单详情
export function subsidyOrderDetail(params) {
  return request({
    url: `${baseUrl}/business_admin/superMember/app/getOrderSubsidyDetail`,
    method: 'get',
    params
  })
}
/************** 超级会员 ************/

/***************绑定桌码********************** */
// 获取用户权限范围内的门店列表
export function getShopList(params) {
  return request({
    url: `${baseUrl}/business_admin/shop/listScope`,
    method: "post",
    data: params
  });
}
// 根据门店获取区域列表
export function getAreas(params) {
  return request({
    url: `${baseUrl}/wcanyin_admin/manage/queryAreasApp`,
    method: "get",
    params
  });
}
// 根据门店和区域获取桌码列表
export function getDesk(params) {
  return request({
    url: `${baseUrl}/wcanyin_admin/manage/queryTablesApp`,
    method: "get",
    params
  });
}
// 绑定桌码
export function bindDesk(params) {
  return request({
    url: `${baseUrl}/business_admin/qrcode/base/bindApp`,
    method: "post",
    data: params
  });
}
// 解绑桌码
export function unBindDesk(params) {
  return request({
    url: `${baseUrl}/business_admin/qrcode/base/unbindApp`,
    method: "delete",
    params: params
  });
}
/***************************************************/

// **自定义表单相关接口 start**
export const getFormPageList = data =>{
  return request({
    url : `${baseUrl}/marketing/lowCode/h5/pageList?page=${data.page}&pageSize=${data.pageSize}`,
    method : 'post',
    data
  })
}

export const updateFormItemStatus = data => {
  return request({
    url : `${baseUrl}/marketing/lowCode/h5/pageUpdateStatus`,
    method : 'post',
    data
  })
}
// **自定义表单相关接口 end**